<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div{width:200px;height:100px;border:1px red solid;display:none}
    </style>
</head>
<body>
<input type="button" value="按钮一" style="background:yellow"/>
<input type="button" value="按钮二"/>
<input type="button" value="按钮三"/>
<div>1</div>
<div>2</div>
<div>3</div>
<script>
    var oDiv=document.getElementsByTagName("div");
    var oIput=document.getElementsByTagName("input");
    for(i=0;i<oIput.length;i++){
        oIput[i].indent=i;
        //通过自定义属性获得下标值
        oIput[i].onclick=function(){
            for(var j=0;j<oIput.length;j++){
                oDiv[j].style.display="none";
            }
            //this.style.background="yellow"
            oDiv[this.indent].style.display="block"
        }
    }
    //for 循环内，有index索引值
</script>
</body>
</html>